
//
//  SampuxWiFiDocumentView.m
//  Sampux
//
//  Created by rzm on 16/7/11.
//  Copyright © 2016年 GaoBiao. All rights reserved.
//

#import "SampuxWiFiGuideView.h"

@implementation SampuxWiFiGuideView

 - (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setupSubView];
    }
    return self;
}

- (void)setupSubView
{
    UIScrollView *scrollview = [[UIScrollView alloc]init];
    scrollview.origin = CGPointMake(0, 64);
    if (self.height - 64 < (1018/2)) {
        scrollview.size = CGSizeMake(kScreenWidth, self.height - 64 - Sampux6HScale(45) - 30);
    } else {
        scrollview.size = CGSizeMake(kScreenWidth, (1018/2));
    }
    [self addSubview:scrollview];
    scrollview.backgroundColor = THSystemClearColor;
    
    scrollview.contentSize = CGSizeMake(scrollview.frame.size.width, 1018/2);
    UIImageView *imageview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, scrollview.contentSize.width, scrollview.contentSize.height)];
    [scrollview addSubview:imageview];
    imageview.image = imageNamed(@"guide");
//
    CGFloat font;
    if (IS_IPHONE_4_OR_LESS) {
        font = 14.;
    }else if (IS_IPHONE_5_OR_LESS)
    {
        font = 15.;
    }else if (IS_IPHONE_6)
    {
        font = 16.;
    }else
    {
        font = 17.;
    }
    UIButton *btn = [UIButton createButtonWithTitle:@"我已完成上述操作" frame: CGRectMake(self.width/2 - Sampux6WScale(552/2)/2, scrollview.bottom + (15) , Sampux6WScale(552/2), Sampux6HScale(SampuxCustomH)) titleFont:THFont(font) titleColor:[UIColor colorWithHex:0xfff45050]];
    [btn setCorner:btn.height/2];
    btn.layer.borderWidth = 1;
    btn.layer.borderColor = THWhiteAlplaColor(0.6).CGColor;
    [self addSubview:btn];
    
    [btn addTarget:self action:@selector(wifi) forControlEvents:UIControlEventTouchUpInside];

}

//- (void)setupSubView
//{
//    
//    NSString *path = [[NSBundle mainBundle] pathForResource:@"docoment" ofType:@"docx"];
//    NSURL *url = [NSURL fileURLWithPath:path];
//    UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.width, self.height - 64 - Sampux6HScale(63))];
//    [self addSubview:webView];
//
//    [webView loadRequest:[NSURLRequest requestWithURL:url]];
//    [webView sizeToFit];
//    webView.scalesPageToFit = YES;
//    UIButton *btn = [UIButton createButtonWithTitle:@"下一步" frame: CGRectMake(self.width/2 - Sampux6WScale(345/2)/2, webView.bottom + Sampux6HScale(10) , Sampux6WScale(345/2), Sampux6HScale(SampuxCustomH)) titleFont:THFont(17) titleColor:THDeFaultBlueColor];
//    [btn setCorner:btn.height/2];
//    btn.layer.borderWidth = 1;
//    btn.layer.borderColor = THWhiteAlplaColor(0.6).CGColor;
//    [self addSubview:btn];
//    
//    [btn addTarget:self action:@selector(wifi) forControlEvents:UIControlEventTouchUpInside];
//}

- (void)wifi
{
    if (self.nextBlock) {
        self.nextBlock();
    }
}


@end
